# RSpec - Use stub_const to stub constants.
# When the constant is already defined, the stubbed value will replace the original value for the duration of the example.
FOO = 7
describe "stubbing FOO" do
it "can stub FOO with a different value" do
stub_const("FOO", 5)
FOO.should eq(5)
end
it "restores the stubbed constant when the example completes" do
FOO.should eq(7)
end
end